package com.roc.web.action.settlemgr;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class MarginAndReturnSearchCondition extends BaseSearchCondition{

	private static final long serialVersionUID = 5290988684817451783L;
	
	private String mchntCd;

	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(mchntCd)){
			filedBeanList.add(new WhereHQLFieldBean("t.mchnt_cd", mchntCd,"=", false));
		}
		
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		String sql = " SELECT count(1) FROM apstfr.tbl_mgm_risk_back t  left join  tbl_mcht_inf a on t.mchnt_cd=a.mcht_cd  where 1=1 ";
		return sql;
	}

	@Override
	protected String getSearchHQL() {
		String sql = " SELECT t.ins_id_cd,t.mchnt_cd,t.term_id,t.security_amt,t.current_amt,t.back_amt,a.NAME FROM apstfr.tbl_mgm_risk_back t  left join  tbl_mcht_inf a on t.mchnt_cd=a.mcht_cd where 1=1 ";
		return sql;
	}

	@Override
	protected String getOrderPartOfHQL() {
		String sql = " order by t.mchnt_cd ";
		return sql;
	}

	public String getMchntCd() {
		return mchntCd;
	}

	public void setMchntCd(String mchntCd) {
		this.mchntCd = mchntCd;
	}
	
	

}
